<template>
    <elm-page-tb>
        <template #top>
            <el-input placeholder="请查询输入内容" prefix-icon='el-icon-search' size="mini" style="width: 250px;"
                      v-model="postData.order_name" clearable></el-input>
            <right>
                <el-button-group>
                    <el-button icon="el-icon-search" size="mini" @click="tablebinding()">查询</el-button>
                    <elm-open-button url="order_edit" icon="el-icon-edit" title="新增" width="900" height="90%">新增
                    </elm-open-button>
                </el-button-group>
            </right>
        </template>
        <elm-table url="/business/my/business/GetOrderByUser" :post-data="postData" :show-index="true" height="100%">
            <el-table-column prop="sys_code_key" label="订单编号" align="center" width="150px">
            </el-table-column>
            <el-table-column prop="order_name" label="订单名称" align="center">
            </el-table-column>
            <el-table-column prop="customer_id" label="客户名称" align="center">
            </el-table-column>
            <el-table-column prop="order_date" label="下单日期" align="center">
              <template v-slot="scope">
                {{ elm.parseTime(scope.row.order_date) }}
              </template>
            </el-table-column>
            <el-table-column prop="delivery_date" label="预计交付日期" align="center">
            </el-table-column>
            <el-table-column prop="total_amount" label="订单总金额(万元)" header-align="center" align="left" width="130px">
            </el-table-column>
            <el-table-column prop="status" label="状态" align="center" width="100px">
            </el-table-column>
            <el-table-column fixed="right" label="操作" width="120px" align="center" style="position:absolute">
                <template v-slot="scope">
                    <elm-open-button url="order_edit" title="编辑" width="900" height="90%" :data="{ model: scope.row }"
                                     type="text">编辑
                    </elm-open-button>
                    <el-button type="text" size="mini" @click="deleteData(scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </elm-table>
    </elm-page-tb>
</template>

<script>
export default {
    extends: elmVueBase,
    data() {
        return {
            postData: {order_name: null}
        }
    },
    async created() {
    },
    methods: {
        async deleteData(data) {
            await this.delete('/business/my/business/DeleteOrder', {id: data.id});
            this.tablebinding();
        }
    }
}
</script>

<style scoped>
</style>